#pragma once
#include "DXAMLCommon.h"

class CDependencyProperty;
class CValue;

class CModifiedValue
{
	enum FullValueSource
	{
		fvsBaseValueSourceMask = 0xF,
		fvsModifiersMask = 0x70,
		fvsIsAnimated = 0x10,
		fvsLocalValueNewerThanAnimatedValue = 0x1000
	};

public: 
	CModifiedValue(CDependencyProperty * pdp);
	~CModifiedValue();
	XBOOL HasModifiers();
	HRESULT GetProperty(CDependencyProperty * * ppdp);
	HRESULT SetAnimatedValue(CValue * pValue);
	HRESULT GetAnimatedValue(CValue * pValue);
	HRESULT ClearAnimatedValue();
	XBOOL IsAnimated();
	HRESULT SetBaseValue(CValue * pValue, enum BaseValueSource baseValueSource);
	HRESULT GetBaseValue(CValue * pValue);
	enum BaseValueSource GetBaseValueSource();
	HRESULT GetEffectiveValue(CValue * pValue);
	XBOOL IsModifierValueBeingSet();
	void SetModifierValueBeingSet(XBOOL bSet);
	XBOOL ShouldTemplateBindingBeStopped();
	void StopTemplateBinding(XBOOL bStop);
private: 
	HRESULT ClearBaseValue();
	XBOOL HasBaseValue();
	CDependencyProperty * m_pdp;
	XBOOL m_fullValueSource;
	CValue * m_pAnimatedValue;
	CValue * m_pBaseValue;
	XBOOL m_bModiferValueBeingSet;
	XBOOL m_bStopTemplateBinding;
};